package com.maxatime.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.maxatime.pojo.dto.GradeDTO;
import com.maxatime.pojo.entity.Dormitory;
import com.maxatime.pojo.entity.Grade;
import com.maxatime.service.DormitoryService;
import com.maxatime.service.GradeService;
import com.maxatime.util.MyContent;

@Controller
@RequestMapping("/Apache")
public class apache {
	
	@Autowired
	GradeService gradeService;//教室
	
	@Autowired
	DormitoryService dormitoryService;//宿舍
	//apache网页练习
	@RequestMapping("/apache")
	public String apache() {
		return "apache/index";
	}
	/**
	 * 
	 * @Title: zzt   
	 * @Description: TODO(形状图)   
	 * @param: @param grade
	 * @param: @return      
	 * @return: Map<String,Object>      
	 * @throws   
	 * @author: ssb    
	 * @date:   2023年10月30日 下午3:44:52   
	 * @version V1.0
	 */
	//柱状形态图全查
	  @RequestMapping("/zzt")
	  @ResponseBody
	  public Map<String, Object> zzt(@RequestBody Grade grade){
		  Map<String, Object> m = new HashMap<>();
		  List<Grade> abc = gradeService.listData2(grade);
		  m.put(MyContent.CODE, "6666");
		  m.put(MyContent.MSG, "查询成功");
		  m.put(MyContent.DATA, abc);
		  return m;
	  }
	  
	  //饼状图全查
	  @RequestMapping("/bzt")
	  @ResponseBody
	  public Map<String, Object> bzt(@RequestBody Dormitory dormitory){
		  Map<String, Object> m = new HashMap<>();
		  List<Dormitory> dor = dormitoryService.listData(dormitory);
		  m.put(MyContent.CODE, "2222");
		  m.put(MyContent.MSG, "查询宿舍成功");
		  m.put(MyContent.DATA, dor);
		  return m;
	  }
}
